cmake_minimum_required(VERSION 3.10)
PROJECT(IFRExtractor)
add_definitions(-std=c++11)
SET(PROJECT_SOURCES_CLI
 Var.cpp
 md5.cpp
 EFI.cpp
 UEFI.cpp
 main-cli.cpp
)

SET(PROJECT_SOURCES_WIN
 Var.cpp
 md5.cpp
 EFI.cpp
 UEFI.cpp
 main.cpp
)

SET(PROJECT_HEADERS 
 Var.h
 md5.h
 VarHeader.h
 EFI.h
 UEFI.h
 UEFIHeader.h
)

set(LINK_DIR /tmp/KlSetupConfig)
link_directories(${LINK_DIR})


FILE(GLOB SOURCE_FILES ejson-master/src/*.cpp)
include_directories(ejson-master/include ./)
IF(WIN32)
  ADD_DEFINITIONS(-DWIN32)
  message( " WIN32 build,use  \"cmake -G \"Unix Makefiles\"  .")
  ADD_EXECUTABLE(ifrextract ${PROJECT_SOURCES_CLI} ${SOURCE_FILES} ${PROJECT_HEADERS})
ELSE()
  ADD_EXECUTABLE(ifrextract ${PROJECT_SOURCES_CLI} ${SOURCE_FILES} ${PROJECT_HEADERS})
ENDIF()

target_link_libraries(ifrextract -static -lstdc++ )

IF(WIN32)
 IF(MSVC)
  ADD_EXECUTABLE(IRFExtractor WIN32 ${PROJECT_SOURCES_WIN} ${PROJECT_HEADERS} ifrextractor.rc)
 ENDIF()
ENDIF()
